<?php

class view
{
    protected $data;

    function render($view, $data = null)
    {
        $file_path = str_replace('/', DIRECTORY_SEPARATOR, $view);
        $file_path = Application::viewPath().$file_path.Application::viewExtenssion();
        if (file_exists($file_path) && is_file($file_path) && is_readable($file_path)) {
            $this->_render($file_path, $data);
        } else {
            throw new ArchException("Can’t load view “{$view}”.");
        }
    }

    protected function _render($file_path, $data)
    {
        $this->data = $data;

        include $file_path;
    }
}

?>